@extends('layouts.app')
@section('title',$user->name.'的个人空间')

@section('content')
    <div class="row">
        <div class="col-lg-3 col-md-3 hidden-sm hidden-xs user-info">
            <div class="card">
                <img class="card-img-top"
                     src="{{$user->avatar}}"
                     alt="{{ $user->name }}"
                >
                <div class="card-body">
                    <h5><strong>个人简介</strong></h5>
                    <p>{{$user->introduction}}</p>
                    <hr>
                    <h5><strong>注册于</strong></h5>
                    <p>{{$user->created_at->diffForHumans()}}</p>
                    <hr>
                    <h5><strong>最后活跃</strong></h5>
                    <p>{{$user->last_actived_at->diffForHumans()}}</p>
                </div>
            </div>
        </div>
        <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
            <div class="card">
                <h1 class="mb-0 p-3" style="font-size: 22px;">{{$user->name}} <small>{{$user->email}}</small></h1>
            </div>
            <hr>
            <div class="card">
                <div class="card-body">
                    <ul class="nav nav-tabs">
                        <li class="nav-item">
                            <a class="nav-link
                            {{active_class(if_query('tab',null))}}"  href="{{route('users.show',$user->id)}}">TA的帖子</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link
                             {{active_class(if_query('tab','replies'))}}"
                               href="{{route('users.show',[$user->id,'tab'=>'replies'])}}">TA的回复</a>
                        </li>
                    </ul>
                    @if(if_query('tab','replies'))
                        @include('users._replies',[
                            'replies'=>$user->replies()->with('topic')->recent()->paginate(5)
                            ])
                    @else
                        @include('users._topics',['topics'=>$topics])
                    @endif

                </div>
            </div>
        </div>
    </div>
@stop

